HAL TimeBase RTC Wakeup Overview

Introducing HAL TimeBase RTC Wakeup

group TimeBase_RTC_Wakeup_Introduction

  • The RTC wake-up timebase pattern provides an alternative to the default Cortex System Timer (SysTick) for the HAL timebase in STM32 microcontrollers.

  • This is useful in applications where SysTick is reserved for an RTOS, or when an ultra-low-power timebase is required. In this case, the RTC peripheral and its wake-up timer feature are used to generate periodic interrupts for the HAL tick.

  • The RTC wake-up timebase implementation is ready-to-use, requires no customization, and integrates seamlessly with the STM32 HAL.

Module and files

The following diagram illustrates the HAL TimeBase RTC Wakeup module and its associated files.

Module and files diagram

Component diagram

The following diagram illustrates the software components involved in the HAL TimeBase RTC Wakeup module. It shows the interactions between the user application, HAL drivers, low-level drivers, and the hardware components.

@startuml timebase_rtc_wakeup_component_diagram
<style>
componentDiagram {
   arrow {
      FontSize 8
   }
}
</style>

title Timebase RTC Wakeup Software Component Diagram

package "HAL" {
    [HAL_CORTEX]
    [HAL_RCC]
    [HAL_TIMEBASE_RTC_WAKEUP]
    [HAL_RTC]
}

package "Low Layer" {
    [LL_RTC]
    [CMSIS]
    [RTC Interrupt routine service]
}

package "HW" {
    [STM32_HW]
}

[Appli] --> [HAL_TIMEBASE_RTC_WAKEUP] : HAL Timebase RTC Wakeup API
[Appli] <-- [HAL_TIMEBASE_RTC_WAKEUP] : RTC Wakeup callback

[HAL_TIMEBASE_RTC_WAKEUP] --> [HAL_RTC] : HAL RTC / Wakeup API

[HAL_RTC] --> [LL_RTC] : LL RTC API
[HAL_RTC] -l-> [CMSIS] : IS_RTC_<FEATURE>_INSTANCE

[HAL_TIMEBASE_RTC_WAKEUP] -l-> [HAL_CORTEX] : HAL_CORTEX_NVIC_SetPriority
[HAL_RTC] -l-> [HAL_RCC] : HAL_RCC_RTCAPB_EnableClock

[HAL_RTC] <-- [RTC Interrupt routine service]

[LL_RTC] --> [CMSIS] : RTC register def

[STM32_HW] -u--> [RTC Interrupt routine service] : RTC Wakeup IRQ
[STM32_HW] <-- [LL_RTC] : RTC registers R/W

@enduml

Configuration table

The following table lists the configuration defines for the HAL TimeBase RTC Wakeup, specifying their locations, default values, and descriptions:

group TimeBase_RTC_Wakeup_Configuration_Table

Configuration inside the timebase RTC wake-up:

Config defines

Where

Default value

Note

USE_HAL_RTC_MODULE

hal_conf.h

1

Enable the HAL RTC module

USE_ASSERT_DBG_PARAM

PreProcessor env

NA

Enable parameter assert